package uk.ac.lkl.lpp.ui;



import java.awt.*;
import javax.swing.*;

import uk.ac.lkl.lpp.PedagogyPlan;

import uk.ac.lkl.lpp.model.PedagogyPlanModel;
import uk.ac.lkl.lpp.model.TeachingMethodTableModel;


public class TeachingMethodsTablePanel extends JPanel {

    private static final long serialVersionUID = 1L;


    public static final String TEACHING_METHODS_PANEL_KEY = "TeachingMethodsPanel";


    private TeachingMethodTableModel tableModel;


    /**
     * Note: does not dynamically update if teaching methods change.
     * 
     */
    public TeachingMethodsTablePanel(PedagogyPlan plan) {
        PedagogyPlanModel model = plan.getModel();
        tableModel = new TeachingMethodTableModel(model);
        addCTable(plan);
    }


    private void addCTable(PedagogyPlan plan) {
        setLayout(new BorderLayout());
        // add(Messages.getJButton(TEACHING_METHODS_PANEL_KEY,true),
        // BorderLayout.NORTH);

        CTable tableView = new CTable(tableModel);
        tableView.setColumnViewCreator(
                                       0,
                                       new LinkingTeachingMethodViewCreator());

        // tableView.setColumnViewCreator(
        // 7,
        // new GroupSizeTeachingMethodViewCreator(
        // plan));

        add(tableView, BorderLayout.CENTER);
    }

}
